<%@include file="template/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>
            ${website} ||
            <c:choose>
                <c:when test="${teacheredit!=null}">Edit</c:when>
                <c:otherwise>Add</c:otherwise>
            </c:choose>teacher
        </title>
        ${stylesheet}
        ${jquery}
        ${jsdropdown}
    </head>
    <body>
        <div class="container">
            <%@include file="template/header.jsp" %>
            <div class="content">
                <h1>Manage teachers</h1>
                <h3>
                    <c:choose>
                        <c:when test="${teacheredit!=null}">Edit</c:when>
                        <c:otherwise>Add</c:otherwise>
                    </c:choose>teacher
                </h3>

                    <c:choose>
                        <c:when test="${teacheredit!=null}">
                             <form action="../ManageTeacher" method="POST" name="teacheradd">
                            <input type="hidden" name="formoption" value="teacheredit"/>
                        </c:when>
                        <c:otherwise>
                             <form action="ManageTeacher" method="POST" name="teacheradd">
                            <input type="hidden" name="formoption" value="teacheradd"/>
                        </c:otherwise>
                    </c:choose>
                    <label for="email">Email</label> <input type="email" name="email" id="email" value="${teacheredit.user.email}" required/>
                    <br />
                    <c:if test="${teacheredit==null}">
                        <label for="password">Password</label> <input type="password" name="password" id="password" required/>
                        <br />
                        <label for="confirmpassword">Confirm password</label> <input type="password" name="confirmpassword" id="confirmpassword" required/>
                        <br />
                    </c:if>
                    <label for="firstname">Firstname</label> <input type="text" name="firstname" id="firstname" value="${teacheredit.firstname}" required/>
                    <br />
                    <label for="insertion">Insertion</label> <input type="text" name="insertion" id="insertion" value="${teacheredit.insertion}" />
                    <br />
                    <label for="lastname">Lastname</label> <input type="text" name="lastname" id="lastname" value="${teacheredit.lastname}" required/>
                    <br />
                    <c:choose>
                        <c:when test="${teacheredit.removable==false}"><input type="hidden" value="${teacheredit.role.role_id}" name="role"/></c:when><c:otherwise>
                    <label for="role">Role</label>
                    <div class="relative">
                        <select class="select" id="teacher" name="role">
                        <c:forEach items="${roleList}" var="roles">
                            <option value="${roles.role_id}" name="" <c:if test="${roles.name == 'Teacher'}">selected</c:if>>${roles.name}</option>
                        </c:forEach>
                    </select>
                    <span class="pointer"><span>
                    </div></c:otherwise>
                    </c:choose>
                    <div class="clear margin-bottom-5"></div>
                    <label for="description">Description</label> <textarea name="description" id="description" required>${teacheredit.description}</textarea>
                    <br />
                    <input type="hidden" name="teacherid" value="${teacheredit.id}"/>
                    <label>&nbsp;</label> <input type="submit" value="Save teacher"/>
                </form>
            </div>
            <%@include file="template/footer.jsp" %>
        </div>
    </body>
</html>
